<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>请输入名字</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
        }
        .container {
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            text-align: center;
        }
        h1 {
            color: #333;
        }
        input[type="text"] {
            width: 80%;
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        button {
            background-color: #ff69b4;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        button:hover {
            background-color: #ff1493;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>请输入你想要传递给对方的名字</h1>
        <input type="text" id="nameInput" placeholder="在这里输入名字...">
        <button onclick="submitName()">确认</button>
    </div>

    <script>
        function submitName() {
            var name = document.getElementById('nameInput').value.trim();
            if (name) {
                // ✅ 改成访问 /love 而不是 /love.html
                window.location.href = 'love?name=' + encodeURIComponent(name);
            } else {
                alert('请输入名字！');
            }
        }
    </script>
</body>
</html>